<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<?php
	echo $this->Html->css('addition-style');
	echo $this->Html->script('more');
?>
<div id="main-form">
	<h1>Add Ledger Entry</h1>
      <?php echo $this->Form->create(); ?>
        <div class="top-group">
          <div class="form-group">
            <label for="">Date</label>
            <?php echo $this->Form->input('entry_date', array('id' => 'datepicker', 'label' => false, 'type' => 'text', 'class' => 'form-control')); ?>
          </div>
        </div>
        <div class="left-group">
          <div class="form-group">
            <label for="">Description</label>
            <?php
            echo $this->Form->textarea('details', array('class' => 'form-control bigger', 'required' => 'required'));
            ?>
          </div>
        </div>
        <div class="mid-group">
          <div class="form-group">
            <label for="">amount</label>
            <div class="amount-control">
              <span class="negative">-US$ (</span>
              <span class="negative">)</span>
              <span class="positive show">US$</span>
              <?php echo $this->Form->input('amount', array('label' => false, 'type' => 'text', 'class' => 'form-control bigger', 'id' => 'amount', 'onkeyup'=> 'ThousandSeparate(this)' )); ?>
            </div>
          </div>
          <div class="form-group debcre">
            <label>Debit</label>
            <input type="radio" name="data[Ledger][type]" id="debit" value="D"/>
            <span>Debit</span>
            <label>Credit</label>
            <input type="radio" checked name="data[Ledger][type]" id="credit" value="C"/>
            <span>Credit</span>
          </div>
          <?php
			$user = $this->Session->read('User');
          	if ( $user['User']['access_level'] < 2 ) {
          		echo "<div class='form-group half'>";
          		echo "<label for=''>Division</label>";
				echo $this->Form->input('division_id', array('label' => false,'div' => 'select-input'));
				echo "</div>";
          		echo "<div class='form-group half'>";
          		echo "<label for=''>Department</label>";
				echo $this->Form->input('department_id', array('label' => false,'div' => 'select-input'));
				echo "</div>";
			}
          ?>
          <div class="form-group">
            <label for="">Category</label>
            <?php
            
            echo $this->Form->input('category_id', array('label' => false,'div' => 'select-input'));

            ?>
          </div>
        </div>
        <div class="right-group">
          <div class="form-group">
            <button type="submit" class="btn btn-primary" value="save">save</button>
            <?php
            	//echo $this->Form->end( 'save' );
            echo $this->Html->link('Reset', array('controller' => 'ledgers', 'action' => 'index'), array("class" => "btn"));
			?>
          </div>
        </div>
    </div>

<script>
$(document).ready(function () { $("#datepicker").val( getCurrentDate() );});
</script>